const mongoose = require('mongoose');

// 数据表名称
// const schema = new mongoose.Schema({
//     // 定义字段 以及字段类型
//     p1: String,
//     p2: String
// })
// 创建模型对象
// const obj = mongoose.model('obj', schema)

const userSchema = new mongoose.Schema({
    username: String,
    password: {
        type: String,
        // 查询的时候密码不可见
        select: false
    },
    avatar: {
        type: String,
        default: ''
    },
    sex: {
        type: Number,
        default: ''
    },
    desc: {
        type: String,
        default: ''
    },
    phone: {
        type: String,
        default: ''
    },
    email: {
        type: String,
        defualt: ''
    }
})

const User = mongoose.model('users', userSchema)

module.exports = {
    User
}